<template>
  <div class="father">
    <button @click="count += 1000">赚钱: {{ count }}</button>

    <!--   2. 父组件内， 通过@自定义事件= "函数"， 监听子组件发来的事件 -->
    <little-horse :xxx="count" @yyy="constMoney"></little-horse>
  </div>
</template>

<script>
import LittleHorse from "./LittleHorse.vue";
export default {
  components: { LittleHorse },
  data() {
    return {
      count: 1000,
    };
  },

  methods: {
    constMoney(num) {
      this.count -= num;
    },
  },
};
</script>

<style scoped>
.father {
  border: 5px solid #ccc;
  border-radius: 10px;
  padding: 50px;
}
</style>
